package com.hzw.code

import android.os.Bundle
import android.view.View
import androidx.lifecycle.Observer
import com.hzw.code.annotation.BindViewModel
import com.hzw.code.vm.PageFragment
import kotlinx.android.synthetic.main.activity_normal.*

/**
 *
 * @Author:         HuaZhongWei
 * @CreateDate:     2020/4/20 16:44
 *
 * @Description:
 *
 */
class NormalFragment : PageFragment() {

    override fun getLayoutResId() = R.layout.activity_normal

    @BindViewModel(NormalViewModel::class)
    lateinit var viewModel: NormalViewModel

    override fun init(savedInstanceState: Bundle?) {
//        val viewModel = (activity as NormalActivity).viewModel

        loadData.setOnClickListener {
            fragmentContainer.visibility = View.GONE
            viewModel.fetchPatientDetail()
        }

        viewModel.patientDetailLiveData.observe(viewLifecycleOwner, Observer {
            logText.text = it.toString()
        })
    }
}